<?php
if (isset($_POST['op']) && !empty($_POST['op'])){
  if(isset($_SERVER["HTTP_X_REQUESTED_WITH"]) && strtolower($_SERVER["HTTP_X_REQUESTED_WITH"])=="xmlhttprequest"){
     $openid=$_POST['op'];
     $phone=$_POST['p'];
     if (empty($openid)) {
       eixt;
     }
     $getUrl='https://nc-api-test.51wom.com/api/customerUserMountainClimbing/message?phone='.$phone;
     $getData=json_decode(file_get_contents($getUrl), true);
     include '../c/config.php';
     $mysqli = new mysqli($dbhost, $dbuser, $dbpwd, $dbName);
      
     $mysqli->query("insert into sms_log(openid,phone,msg,createtime) values('".$openid."','".$phone."','".json_encode($getData, JSON_UNESCAPED_UNICODE)."','".date("Y-m-d H:i:s")."') ");
     $mysqli->close();
     echo 1;

  }
}
?>